package com.lanou.myapplication.PhotoViewpagerAdapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.lanou.myapplication.PhotoViewpagerFragement.PhotoFragment;
import com.lanou.myapplication.entity.Pics;
import com.lanou.myapplication.entity.Technology;
import com.lanou.myapplication.technologyFragment.HeadLineFragment6;

import java.util.List;

/**
 * Created by dllo on 15/10/23.
 */
public class PhotoViewPagerAdapterfirst extends FragmentPagerAdapter {
    private List<Pics> pics;

    public void addData(List<Pics> data){
        pics =data;
      notifyDataSetChanged();
    }


    public PhotoViewPagerAdapterfirst(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        Pics p =  pics.get(position);
        String alt =p.getAlt();
        String pic=p.getPic();
        int sum = pics.size();


        return PhotoFragment.getInstance(alt,pic,position ,sum);
    }

    @Override
    public int getCount() {
        return pics != null && pics.size() > 0
          ? pics.size() :0;
    }
}
